<?php include_once("../../../common/common_setting_unit.php");         // 引入通用的设置文件 ?>

<?php

$plate=select_one_line_all_items($table_Prefix."plate","mid = 'department'");
?>


<?
//用来判断当前系统属于什么板块
$system_part = $plate['mid'];
?>
  



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<?php include_once(ROOT_PATH_.'/controller/module/head.php'); ?>
</head>

<body>
 



 
<?php



$new_name      = addslashes($_REQUEST['name']);
$new_status    = addslashes($_REQUEST['status']);
$new_phone     = addslashes($_REQUEST['phone']);
$new_location  = addslashes($_REQUEST['location']);
$new_status    = addslashes($_REQUEST['status']);
$new_principal = addslashes($_REQUEST['principal']);
$new_tag       = addslashes($_REQUEST['tag']);
$new_remark    = addslashes($_REQUEST['remark']);
$parent_id    = $_REQUEST['parent_id'];



//这里是设计上传文件的部分：包含图片和附件。视频也应该用这种形式上传
//统一设置一下保存图片的路径
$_uf['path']        = ROOT_PATH_ . "/uploadfiles/".$theme_folder."/";

//创建删除文件存放文件夹
if(!file_exists($_uf['path'] ."/delete/")){
    mkdir($_uf['path'] ."/delete/",0777,true);
    chmod($_uf['path'] ."/delete/",0777);
}




//上传icon
if (is_uploaded_file($_FILES['icon']['tmp_name']))
{
    $_uf['upfile']       = $_FILES['icon'];
    $_info               = upload_file($_uf);
    $_REQUEST['ai_icon'] = $_info['name'];
    if(($_REQUEST['ai_icon'])&&($old_detail['icon']!="alpha.gif"))
    {
        rename($_uf['path'].$old_detail['icon'], $_uf['path'] ."delete/".$old_detail['icon']);
    }
}



//设置需要搜索的表格的前缀后缀
$table_Suffix = "brand";
$table = $table_Prefix . $table_Suffix;
//设置需要搜索的表格的前缀后缀


if(isset($_REQUEST['ai_icon'])) {
    $sql = "INSERT INTO $table (
    name,
    status,
    icon,
    remark
    )
    
    value (
    '$new_name',
    '$new_status',
    '$_REQUEST[ai_icon]',
    '$new_remark'
    )";
}
else {
    $sql = "INSERT INTO $table (
    name,
    status,
    remark
    )
    
    value (
    '$new_name',
    '$new_status',
    '$new_remark'
    )";
}
$query = mysql_query($sql) or die ('添加数据失败！！'.mysql_error().$sql);



//clear_department_cache();
//clear_cache();

?>





<script type="text/javascript">
    alert("输入信息已保存，点击确认返回继续操作.");
    document.location.href = "detail-list.php?now_extender=department";
</script>
</body>